package com.ymatou.iapi.productmanager.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductListDto;
import com.ymatou.iapi.productmanager.parameter.alhbean.ProductRebateRateDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*通过商品id列表查询安利会费率Call
*FreeMaker Template自动生成代码
*/
public class GetAlhProductsRebateRateCall extends YmatouBaseCall{
	private static String opurl ="api/sellerproduct/GetAlhProductsRebateRate";
	
	public GetAlhProductsRebateRateCall() {
		super(EnvSetup.getSystemUrl("productmanager"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<ProductRebateRateDto> getProductRebateRateDtos(){
		String sResults=getJsonObject().get("Data").getAsJsonObject().get("ProductList").getAsJsonArray().toString();
		List<ProductRebateRateDto> productRebateRateDtos=(List<ProductRebateRateDto>) FormatUtil.GSONToObject(sResults, new TypeToken<List<ProductRebateRateDto>>(){}.getType());
		return productRebateRateDtos;
	}
	
}